#!/bin/sh

# Author: Zhang Huangbin (michaelbibby <at> gmail.com)

# Variables for OpenLDAP and related.

export OPENLDAP_ROOTDIR="/etc/openldap"
export OPENLDAP_SCHEMA_DIR="${OPENLDAP_ROOTDIR}/schema"
export OPENLDAP_CACERT_DIR="${OPENLDAP_ROOTDIR}/cacerts"
export OPENLDAP_SLAPD_CONF="${OPENLDAP_ROOTDIR}/slapd.conf"
export OPENLDAP_LDAP_CONF="${OPENLDAP_ROOTDIR}/ldap.conf"
export OPENLDAP_LOGFILE='/var/log/openldap.log'
export OPENLDAP_DATA_DIR='/var/lib/ldap' # Do *NOT* end with '/'.
export OPENLDAP_SYSCONFIG_CONF="${ETC_SYSCONFIG_DIR}/ldap"
export OPENLDAP_LOGROTATE_FILE="${LOG_ROTATE_DIR}/openldap"

# Setting for one instance. You can edit ${OPENLDAP_SLAPD_CONF} manually to hold
# multi instances.
export LDAP_DATA_DIR="${OPENLDAP_DATA_DIR}/${LDAP_SUFFIX_MAJOR}.${LDAP_SUFFIX_MINOR}/"
export LDAP_INIT_LDIF="${CONF_DIR}/ldap_init.ldif"
#
# Account info for all services to bind to LDAP service.
#
export LDAP_SERVER_HOST='127.0.0.1'
export LDAP_SERVER_PORT='389'
export LDAP_BIND='yes'
export LDAP_BIND_VERSION='3'
export LDAP_BINDPW="$(echo $RANDOM\$$RANDOM\@$RANDOM\!$RANDOM\&$RANDOM\*$RANDOM\)$RANDOM)"

# ---------- LDAP schema related -----------
# objectClass
export LDAP_OBJECTCLASS_DOMAIN='mailDomain'
export LDAP_OBJECTCLASS_USER='mailUser'

# service related attrubites.
export LDAP_ATTR_ENABLE_MAIL_SERVICE='enableMailService'
export LDAP_ATTR_ENABLE_IM_SERVICE='enableIMService'
export LDAP_ATTR_ENABLE_FTP_SERVICE='enableFTPService'

# Domain related.
export LDAP_ATTR_DOMAIN_DN_NAME='domainName'
export LDAP_ATTR_DOMAIN_TRANSPORT='mtaTransport'
export LDAP_ATTR_DOMAIN_STATUS='domainStatus'
export LDAP_ATTR_DOMAIN_QUOTA='domainMaxQuotaSize'
export LDAP_ATTR_DOMAIN_USER_NUMBER='domainMaxUserNumber'
export LDAP_ATTR_DOMAIN_SENDER_BCC_ADDRESS='domainSenderBccAddress'
export LDAP_ATTR_DOMAIN_RECIPIENT_BCC_ADDRESS='domainRecipientBccAddress'

# User related.
export LDAP_ATTR_USER_DN_NAME='mail'
export LDAP_ATTR_USER_PASSWD='userPassword'
export LDAP_ATTR_USER_SENDER_BCC_ADDRESS='userSenderBccAddress'
export LDAP_ATTR_USER_RECIPIENT_BCC_ADDRESS='userRecipientBccAddress'
export LDAP_ATTR_USER_STATUS='accountStatus'
export LDAP_ATTR_USER_QUOTA='mailQuota'
export LDAP_ATTR_USER_ALIAS='mailForwardingAddress'
export LDAP_ATTR_USER_ENABLE_SMTP='enableSMTP'
export LDAP_ATTR_USER_ENABLE_POP3='enablePOP3'
export LDAP_ATTR_USER_ENABLE_IMAP='enableIMAP'
export LDAP_ATTR_USER_ENABLE_DELIVER='enableDELIVER'
export LDAP_ATTR_USER_RESTRICTION_CLASS='restrictionClass'
export LDAP_ATTR_USER_RESTRICTED_DOMAIN='restrictedDomain'
